This method calculates the Moving Average. There is a number a different moving averages supported by this method.
var MA(period, maType, dataArray, calculatedDataArray);
period
Period integer value.
maType
One of the Moving Average constants, defined here.
dataArray
Array object filled with data values for which to calculate moving average.
calculatedDataArray
Empty Array object that will be filled with calculated data.
Returns true if calculation was completed successfully, or false otherwise.
The following example demonstrates how to use MA method.
function calculate(beginIndex, endIndex)
{
var period = 15;
var maType = TechnicalAnalysis.MA_EMA;
var dataArray = new Array();
//populate data array...
...
...
var calculatedDataArray = new Array();
var rc = TechnicalAnalysis.MA(period, maType, dataArray, calculatedDataArray);
}
Copyright © 2006-2009 ActiveTick LLC